package com.kaibes.module.theme;

import javax.validation.constraints.NotEmpty;

import org.springframework.web.bind.annotation.PutMapping;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.kaibes.core.base.annotation.Description;

import lombok.Data;

/**
CREATE TABLE `theme` (
  `id` tinyint unsigned NOT NULL AUTO_INCREMENT,
  `path` varchar(64) NOT NULL,
  `uri` varchar(64) DEFAULT NULL,
  `enable` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `path` (`path`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
 */
@Data
@Description("主题信息")
public class Theme {
    
    @Description("主题ID")
    private Integer id;
    @Description("映射路径")
    private String uri;
    @NotEmpty(groups = PutMapping.class, message = "文件夹路径不能为空")
    @Description("主题位置")
    private String path;
    @Description("是否启用")
    private boolean enable;
    
    @JsonIgnore
    public String getTargetUri() {
        return "/"+path+"/thumbnail.png";
    }
}
